#ifndef ORG_WXW0303_SYMBOL_DB_SYMFINDPRINT_H
#define ORG_WXW0303_SYMBOL_DB_SYMFINDPRINT_H

#include <memory>


#include "sym-info-table.h"
struct SymName;

/**
 * SymFindPrint;用来输出 sym-find 的结果.
 * 对该类的使用也很简单:
 *      init(); 根据命令行参数初始化其行为.
 *      print(); 输出一个结果.
 *      flush(); 刷新一下.
 */
struct SymFindPrint {
    inline ~SymFindPrint();

    void init(int argc,char **argv);
    void print(SymInfoTable::id_t id,std::shared_ptr<SymName> symname);
    void flush();
private:
    void do_print(SymInfoTable::id_t id,std::shared_ptr<SymName> symname);
private:
    bool detail_info = false;
    bool print_language = false;
    size_t printed_symbol_num = 0;
    SymInfoTable::id_t id_bak;
    std::shared_ptr<SymName> symname_bak;
};

inline SymFindPrint::~SymFindPrint() {
    flush();
}



#endif // ORG_WXW0303_SYMBOL_DB_SYMFINDPRINT_H
